package com.esri.core.map;

import java.util.Calendar;

/* loaded from: classes.dex */
public class TimeExtent {
    private Calendar a;
    private Calendar b;

    public TimeExtent(Calendar calendar) {
        this(calendar, calendar);
    }

    public TimeExtent(Calendar calendar, Calendar calendar2) {
        setStartDate(calendar);
        setEndDate(calendar2);
    }

    public Calendar getStartDate() {
        return this.a;
    }

    public void setStartDate(Calendar calendar) {
        this.a = calendar;
    }

    public Calendar getEndDate() {
        return this.b;
    }

    public void setEndDate(Calendar calendar) {
        this.b = calendar;
    }

    public boolean intersects(Calendar calendar) {
        Calendar calendar2;
        return (calendar == null || (calendar2 = this.a) == null || this.b == null || calendar2.compareTo(calendar) >= 1 || this.b.compareTo(calendar) <= -1) ? false : true;
    }

    public boolean intersects(TimeExtent timeExtent) {
        Calendar calendar;
        Calendar calendar2;
        return (timeExtent == null || (calendar = timeExtent.a) == null || timeExtent.b == null || this.a == null || (calendar2 = this.b) == null || calendar.compareTo(calendar2) > 0 || timeExtent.b.compareTo(this.a) < 0) ? false : true;
    }

    public TimeExtent offset(int i, int i2, int i3) {
        return offset(i, i2, i3, 0, 0, 0, 0);
    }

    public TimeExtent offset(int i, int i2, int i3, int i4) {
        return offset(0, 0, 0, i, i2, i3, i4);
    }

    public TimeExtent offset(int i, int i2, int i3, int i4, int i5, int i6, int i7) {
        return new TimeExtent(a(this.a, i, i2, i3, i4, i5, i6, i7), a(this.b, i, i2, i3, i4, i5, i6, i7));
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            TimeExtent timeExtent = (TimeExtent) obj;
            return this.a.equals(timeExtent.a) && this.b.equals(timeExtent.b);
        }
        return false;
    }

    public int hashCode() {
        Calendar calendar = this.a;
        int hashCode = ((calendar == null ? 0 : calendar.hashCode()) + 31) * 31;
        Calendar calendar2 = this.b;
        return hashCode + (calendar2 != null ? calendar2.hashCode() : 0);
    }

    public String toString() {
        Calendar calendar = this.a;
        if (calendar == null && this.b == null) {
            return null;
        }
        if (calendar != null && calendar.equals(this.b)) {
            return new Long(this.a.getTimeInMillis()).toString();
        }
        StringBuilder sb = new StringBuilder();
        Calendar calendar2 = this.a;
        sb.append(calendar2 == null ? "" : Long.valueOf(calendar2.getTimeInMillis()));
        sb.append(",");
        Calendar calendar3 = this.b;
        sb.append(calendar3 != null ? Long.valueOf(calendar3.getTimeInMillis()) : "");
        return sb.toString();
    }

    private Calendar a(Calendar calendar, int i, int i2, int i3, int i4, int i5, int i6, int i7) {
        Calendar calendar2 = (Calendar) calendar.clone();
        calendar2.add(1, i);
        calendar2.add(2, i2);
        calendar2.add(5, i3);
        calendar2.add(10, i4);
        calendar2.add(12, i5);
        calendar2.add(13, i6);
        calendar2.add(14, i7);
        return calendar2;
    }
}
